import request from "@/axios"
import { ResponseData } from "../../../../constants"

enum Api {
  dictionary = "/dictionary",
  saveDictionary = "/dictionary/save",
  updateDictionary = "/dictionary/update",
  saveDictionaryOptions = "/dictionary/saveOptions",
  getDictionaryOptions = "/dictionary/options"
}

export const dictionaryApi = {
  getDictionaryOptionsApi: (dictionaryId: string) => {
    return request.get<ResponseData>(Api.getDictionaryOptions, { dictionaryId })
  },

  saveDictionaryOptionsApi: (params: any) => {
    return request.post<ResponseData>(Api.saveDictionaryOptions, params)
  },

  getDictionary: (params: any) => {
    return request.get<ResponseData>(Api.dictionary, params)
  },
  saveDictionaryApi: (params: any) => {
    return request.post<ResponseData>(Api.saveDictionary, params)
  },
  updateDictionaryApi: (params: any) => {
    return request.post<ResponseData>(Api.updateDictionary, params)
  }
}